package ZuoYe6_DuoChongXunHuan_0424;

import java.util.Arrays;

public class ZuoYe7_HeBingShuZu {

	public static void main(String[] args) {
//		7:定义两个递增有序的数组,把其合并成一个数组,并保证其仍然是有序的.
//		 比如,数组{1,3,5}和{2,4,6,8},合并后是{1,2,3,4,5,6,8}
//		提示:新数组长度是两者的和,判断每一个数是大是小,放入新数组中
		int[] s1 = { 1, 3, 5 };
		int[] s2 = { 2, 4, 6, 8 };
		int[] s3 = new int[s1.length + s2.length];
		for (int i = 0; i < s3.length; i++) {
			if (i < s1.length) {
				s3[i] = s1[i];
			} else {
				s3[i] = s2[i - s1.length];
			}
		}
		Arrays.parallelSort(s3);
		System.out.println(Arrays.toString(s3));
	}

}
